<?php

/*
 * To change this template, choose Tools | Templates
* and open the template in the editor.
*/

class HT_Model_administrator_models_mobileapp extends Zend_Db_Table {//ten class fai viet hoa

	protected $_db;

	public function __construct() {
		$this->_name = "mobile_apps";
		$this->_db = Zend_Registry::get('dbMain');
		parent::init();
	}
	
	public function testFunc(){
		echo "Test mobileapp model done!";
	}
	
	public function getMobileAppsWithCond($condition="1=1") {
		$name = 'mobile_apps';
		$cond = $condition;
		$select = $this->_db->select()
							->from($name)
							->join('mobile_usage', "mobile_usage.app_id = $name.id", array('date','total_use'=>'SUM(count)'))
							->where($cond)
							->group("mobile_usage.app_id");
		$result = $this->_db->fetchAll($select);
		return $result;			
	}
}